package com.xyzh.stj.web.controller;


import com.xyzh.application.common.util.ResultHelper;
import com.xyzh.stj.web.entity.ObjectsAttrEntity;
import com.xyzh.stj.web.service.ObjectsAttrService;
import com.xyzh.stj.web.service.impl.ObjectsAttrServiceImpl;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import com.xyzh.application.base.controller.BasicController;

/**
 * <p>
 * 属性表 前端控制器
 * </p>
 *
 * @author @JZB
 * @since 2024-01-09
 */
@Api(tags = "属性表模块")
@RestController
@RequestMapping("/model")
public class ObjectsAttrController extends BasicController<ObjectsAttrServiceImpl, ObjectsAttrEntity> {


   @Autowired
   private ObjectsAttrService objectsAttrService;

    @ApiOperation("根据entityId获取属性")
    @GetMapping("/attrs/{entityId}")
    public ResultHelper getRoleRights(@PathVariable("entityId") long entityId) {
        return ResultHelper.succeed(objectsAttrService.getModelAttrs(entityId));
    }

    @ApiOperation("根据entityId获取属性")
    @GetMapping("/attrs")
    public ResultHelper getRoleRights(@RequestParam("modelName") String modelName) {
        return ResultHelper.succeed(objectsAttrService.getModelAttrsByName(modelName));
    }

    @ApiOperation("根据输入code查询所有字串")
    @GetMapping("/panels")
    public ResultHelper getPanelsByCode(@RequestParam(name ="code",required = true) String code) {
        return ResultHelper.succeed(objectsAttrService.getPanelsByCode(code));
    }


}
